#pragma once

#ifdef WIN32
#include <windows.h>

#include <gl/glew.h>
#include <gl/wglew.h>

#include <gl/glut.h>

#include <gl/gl.h>
#include <gl/glu.h>

#endif

const int GLUT_WHEEL_UP=3, GLUT_WHEEL_DOWN=4;

#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/traits.hpp>

typedef boost::numeric::ublas::bounded_vector<float, 2> vec2;
typedef boost::numeric::ublas::bounded_vector<float, 3> vec3;
typedef boost::numeric::ublas::bounded_vector<float, 4> vec4;
typedef boost::numeric::ublas::vector<int> ivec;

typedef boost::numeric::ublas::bounded_matrix<float, 4, 4> mat4;

#include "util.h"

#define usingMatrix(m) MatrixStackFrame matrix__##m(m); 

class MatrixStackFrame {
public:
	MatrixStackFrame(GLenum matrix);
	~MatrixStackFrame();
private:
	GLenum matrix;
};

void check();

float centerFitRectagle(unsigned int w, unsigned int h, float minX, float maxX, float minY, float maxY);

vec3 project(vec3 p);
vec3 project(float x, float y, float z);

vec3 unproject(vec3 v);
vec3 unproject(float x, float y, float z);
	